home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Developer Helper 1: Phil & Dave's Excellent CD
/
Excellent CD HFS.raw
/
Moof
/
Goodies
/
HyperCard Goodies
/
Serial Toolkit
/
Source Code
/
killSPort.p
< prev
next >
Wrap
Text File
|
1988-11-18
|
2KB
|
75 lines
(*
killSPort in/out/both -- Kill I/O on the current serial port. If the parameter is "in", then kill
the input; if the parameter is "out" then kill the output; otherwise kill both.
To compile and link this file using Macintosh Programmer's Workshop,
pascal -w killSPort.p
link -m ENTRYPOINT -o HyperCommands -rt XCMD=7032 -sn Main=killSPort ∂
killSPort.p.o "{MPW}"Libraries:interface.o
© Copyright 1987,88 by Apple Computer, Inc.
Initial coding 9/87 by Harry R. Chesley.
*)
{$R-}
{$S killSPort } { Segment name must be the same as the command name. }
unit DummyUnit;
interface
uses MemTypes, QuickDraw, OSIntf, HyperXCmd;
procedure EntryPoint(paramPtr: XCmdPtr);
implementation
type
Str31 = String[31];
procedure killSPort(paramPtr: XCmdPtr); forward;
procedure EntryPoint(paramPtr: XCmdPtr);
begin
killSPort(paramPtr);
end;
procedure killSPort(paramPtr: XCmdPtr);
var inOutBoth: Str255;
{$I XCmdGlue.inc}
procedure Fail(errMsg: Str255); { set theResult and quit }
begin
paramPtr^.returnValue := PasToZero(errMsg);
exit(killSPort);
end;
{$I SPortUtil.inc}
begin
if paramPtr^.paramCount <> 1 then Fail('parameter count is not 1');
SetUpSPortGlobals;
EnsureOpenPort;
GetStrParm(1,inOutBoth);
if StringEqual(inOutBoth,'in') or StringEqual(inOutBoth,'both') then
begin
if KillIO(ThisSPort.portInDev) <> noErr then Fail('KillIO failed');
end;
if StringEqual(inOutBoth,'out') or StringEqual(inOutBoth,'both') then
begin
if KillIO(ThisSPort.portOutDev) <> noErr then Fail('KillIO failed');
end;
end;
end.